package hn.cch.mybatis.boot.provider;

import org.apache.ibatis.builder.annotation.ProviderMethodResolver;
import org.apache.ibatis.jdbc.SQL;

/**
 * 实现ProviderMethodResolver接口，在@XxxxxxProvider注解中不要指定方法，默认匹配到同名方法上
 */
public class ProviderMethodResolverImpl implements ProviderMethodResolver {

    public String providerMethod(String orderColumn) {
        return new SQL() {{
            SELECT("primary_key", "column_name");
            FROM("table_entity");
            WHERE("table_column = #{}");
            ORDER_BY(orderColumn);
        }}.toString();
    }
}
